<div class="xrp" id = "toipc_xrp">
    {% for topic in topics %}
    <div class="xu xe">
        <span class="xok"><a class="nor" href="/topic/{{topic.name}}">{{topic.name}}</a>
	    <a id="rmid-{{topic.id}}" href="javascript:;" class="xd xml" name="remove"></a></span>
	</div>
	{% end %}
	<div class="xu xmf">
	    <input class="xsj xvw label-input-label" title="搜索话题" aria-haspopup="true" 
	        id="topic_search" ">
	    <a class="xvw xow" href="javascript:;" name="add" style="display: none; ">添加</a>
	    <a href="javascript:;" name="close" id="topic_close">完成</a>
	</div>
</div>

<script type="text/javascript">
<!--
$('.xml').bind('click', function()
{
    rmid = $(this).attr("id")
    topic_id = rmid.substring(5, rmid.length)
    $(this).parent().hide()
    $.ajax({
		  type: "POST",
		  url: "/question/unbind",
		  data: {"question_id":question_id, "topic_id":topic_id},
		  success: function(msg){
		    
		   }
		});
});

$('#topic_close').bind('click', function()
{
    var topic_id = $('#topic_search').val()
    var str = "<a class=\"xsk\" href=\"/topic/"+topic_id+"\" data-tip=\"t$b$"+topic_id+"\" data-token=\""+topic_id+"\" data-topicid=\""+topic_id+"\">"+topic_id+"</a>"
    $('#topic_show').append(str)
    $('#topic_show').show()
    $('#toipc_xrp').hide()
    
    $.ajax({
		  type: "POST",
		  url: "/question/bind",
		  data: {"question_id":question_id, "topic_id":topic_id},
		  success: function(msg){
		    $('.xmf').before(msg)
		   }
		});
});



function topic_search()
{
	if ($('#search_text').val() != '')
	{
		$('#topic_search_box').show();
	}
	else
	{
		$('#topic_search_box').hide();
	}
}

-->